// project1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

//rectangle function

void rectangle()
{
	double width;
	double length;
	cout << "width: ";
		cin >> width;
		cout << "length: ";
		cin >> length;
		cout << width*length;
}
//square function

void square()
{
	double sides;
	cout << "sides: ";
		cin >> sides;
		cout << sides*sides;
}
//circle function

void circle()
{
	double radius;
	cout << "radius: ";
		cin >> radius;
		cout << 2*3.14*radius;
}
//triangle function

void triangle()
{
	double base;
	double width;
	cout << "base: ";
	cin >> base;
	cout << "width: ";
	cin >> width;
	cout << (base*width)/2;
}

bool answer()
{
	char answer1;
	cout << "do you want to continue ?(y/n)";
	cin >> answer1;
	if (answer1 == 'y')
	{
		return true;
	}
	else if(answer1 == 'n')
	{
		return false;
	}
}



int _tmain(int argc, _TCHAR* argv[])
{

	string shape1;
	char answer1;
	bool test = true;

	while(test){

	cout << "what shapes do you want to calculate? ";
	cin >> shape1;

	if (shape1.compare("rectangle")==0){

		rectangle();
	}
	else if (shape1.compare("square")==0){
		square();
	}
	else if (shape1.compare("circle")==0){
		circle();
	}
	else if (shape1.compare("triangle")==0){
		triangle();

	}
	
	cout << endl;
	test = answer();
	}

	system("PAUSE");
	return 0;
}
